package ar.com.binarit

import ar.com.binarit.entities.Categoria


class MubbiaTagLib {
	
	def springSecurityService
	
	static namespace = "my"
	
	def mubbiaItems = {attrs ->
		def logeado = springSecurityService.currentUser
		def mubbias = attrs.listadoMubbias
		out << g.render(template:"/templates/mubbiaItems", model:[mubbias:mubbias])
	}
	
	def mubbiasDeUsuario = {attrs ->
		def logeado = springSecurityService.currentUser
		def mubbias = attrs.listadoMubbias
		if (mubbias){
			mubbias = mubbias.sort{it.fechaPublicacion}
		}
		out << g.render(template:"/templates/mubbiasDeUsuario", model:[mubbias:mubbias])
	}
	
	def sideBarIndex = {attrs ->
		//TODO: Poner cual categoria esta activa
		def logeado = springSecurityService.currentUser
		def categorias = Categoria.all
		out << g.render(template:"/templates/sideBarIndex", model:[categorias:categorias])
	}

}
